package com.itheima01.day06;

import java.util.Random;
import java.util.Scanner;

/**
 * @author 刘全
 * @date 2021/7/6
 */
public class Test01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random r = new Random();
        System.out.println("请输入一个数作为数组长度");
        int length = sc.nextInt();
        int[] arr = new int[length];
        for (int i = 0; i < arr.length; i++) {
            int num = r.nextInt(9) + 1;
            arr[i] = num;
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        System.out.print("[");
        for (int start = 0, end = length - 1; start < end; start++, end--) {
            int temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
        }
        for (int i = 0; i < length; i++) {
            if (i < length - 1) {
                System.out.print(arr[i]+",");
            }else{
                System.out.println(arr[i]+"]");
            }
        }
    }
}
